QuickTime 4 API Documentation

Inside Macintosh: QuickTime

Previous | Overview | Contents | Next |

Undo for Movies

The Movie Toolbox provides functions that allow you to capture and restore the edit state of a movie. An edit state contains information that completely defines a movie's content at the time you create the edit state. It is, in essence, a checkpoint in the edit session. You can manage a movie's edit states in order to implement an undo capability for editing movies. For example, you can capture a movie's edit state before performing an editing operation, such as a cut, and later restore the old state. You can have several movie edit states obtained at different times during an editing session, and restore to any one of them at any time. In this manner, you can provide a multilevel undo capability. This section describes the Movie Toolbox functions that work with edit states.

Note that a movie's edit state does not save everything about a movie. Most important, the edit state does not contain information about the movie's spatial characteristics. For example, the edit state does not store the current boundary rectangle or clipping region. Consequently, edit states are best suited to supporting undo operations involving movie content, including track creation and removal. You can use other Movie Toolbox functions to support undo operations for movie characteristics. See "Functions That Modify Movie Properties," to learn more about these functions.

You can use the NewMovieEditState function to capture a movie's edit state. Use the UseMovieEditState to restore the movie to its condition according to a previous edit state. Your application must dispose of an edit state by calling the DisposeMovieEditState function. You must dispose of a movie's edit states before you dispose of the movie.

NewMovieEditState

You can create an edit state by calling the NewMovieEditState function. This function creates an edit state that contains all the information describing a movie's content, including the current selection, the movie's tracks, and the media data associated with those tracks.

Note
You must dispose of a movie's edit states before you dispose of the movie itself. Use the DisposeMovieEditState function (described on DisposeMovieEditState ) to dispose of an edit state.

pascal MovieEditState NewMovieEditState (Movie theMovie);
theMovie
Specifies the movie for this operation. Your application obtains this movie identifier from such functions as NewMovie , NewMovieFromFile , and NewMovieFromHandle (described on NewMovie , NewMovieFromFile , and NewMovieFromHandle , respectively).

DESCRIPTION

The NewMovieEditState function returns a movie edit state identifier. You can use this identifier with other Movie Toolbox edit state functions, such as UseMovieEditState (described in the next section). If this function could not create the edit state, it sets this returned identifier to nil .

ERROR CODES

invalidMovie

-2010

This movie is corrupted or invalid

Memory Manager errors

UseMovieEditState

Your application can use the UseMovieEditState function to return a movie to its condition according to an edit state you created previously.

pascal OSErr UseMovieEditState (Movie theMovie,
                                         MovieEditState toState);
theMovie
Specifies the movie for this operation. Your application obtains this movie identifier from such functions as NewMovie , NewMovieFromFile , and NewMovieFromHandle (described on NewMovie , NewMovieFromFile , and NewMovieFromHandle , respectively).

toState
Specifies the edit state for this operation. Your application obtains this edit state identifier when you create the edit state by calling the NewMovieEditState function (described in the previous section).

DESCRIPTION

The UseMovieEditState function uses the information stored in the edit state to update the movie's contents. This may change the contents of some of the movie's tracks, or it may even add tracks to the movie or remove tracks from the movie. Consequently, the movie's time and spatial characteristics, especially the duration, may change as a result of restoring the saved edit state. Your application creates an edit state by calling the NewMovieEditState function, which is described in the previous section.

ERROR CODES

invalidMovie

-2010

This movie is corrupted or invalid

invalidEditState

-2023

This edit state is invalid

nonMatchingEditState

-2024

This edit state is not valid for this movie

staleEditState

-2025

Movie or track has been disposed

DisposeMovieEditState

The DisposeMovieEditState function disposes of an edit state. Your application must dispose of any edit states you create.

Note
You must dispose of a movie's edit states before you dispose of the movie itself.

pascal OSErr DisposeMovieEditState (MovieEditState state);
state
Specifies the edit state for this operation. Your application obtains this edit state identifier when you create the edit state by calling the NewMovieEditState function.

ERROR CODES

invalidEditState

-2023

This edit state is invalid

staleEditState

-2025

Movie or track has been disposed

SEE ALSO

You create an edit state by calling the NewMovieEditState function, which is discussed on NewMovieEditState .


© 1999 Apple Computer, Inc.

Previous | Overview | Contents | Next